package com.ruicar.afs.cloud.account.common.controller;

import com.ruicar.afs.cloud.account.common.entity.VoucherBuryingPointConfiguration;
import com.ruicar.afs.cloud.account.common.service.VoucherBuryingPointConfigurationService;
import com.ruicar.afs.cloud.common.core.log.annotation.SysLog;
import com.ruicar.afs.cloud.common.core.query.QueryCondition;
import com.ruicar.afs.cloud.common.core.util.IResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author infinity
 * @version 1.0
 * @date 2020/7/12 15:34
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/voucherBuryingPointConfiguration")
@Api(value = "voucherBuryingPointConfiguration", description = "凭证埋点事件配置信息")
public class VoucherBuryingPointConfigurationController {
private final VoucherBuryingPointConfigurationService voucherBuryingPointConfigurationService;

    @PostMapping("/addVoucherBuryingPoint")
    @ApiOperation(value = "添加埋点事件")
    @SysLog(value = "添加埋点事件")
    public IResponse<Boolean> addVoucherBuryingPoint(@RequestBody @Validated VoucherBuryingPointConfiguration voucherBuryingPointConfiguration){
        return IResponse.success(voucherBuryingPointConfigurationService.addVoucherBuryingPoint(voucherBuryingPointConfiguration));
    }

    @DeleteMapping("/delVoucherBuryingPoint/{atomId}")
    @ApiOperation(value = "删除埋点事件")
    @SysLog(value = "删除埋点事件")
    public IResponse<Boolean> delVoucherBuryingPoint(@PathVariable String atomId){
        return IResponse.success(voucherBuryingPointConfigurationService.delVoucherBuryingPoint(atomId));
    }

    @PostMapping("/modifyVoucherBuryingPoint")
    @ApiOperation(value = "编辑埋点事件")
    @SysLog(value = "编辑埋点事件")
    public IResponse<Boolean> modifyVoucherBuryingPoint(@RequestBody @Validated VoucherBuryingPointConfiguration voucherBuryingPointConfiguration){
        return IResponse.success(voucherBuryingPointConfigurationService.modifyVoucherBuryingPoint(voucherBuryingPointConfiguration));
    }

    @PostMapping("/list")
    @ApiOperation(value = "查询埋点事件")
    @SysLog(value = "查询埋点事件")
    public IResponse queryBuryingPointList(@RequestBody QueryCondition<VoucherBuryingPointConfiguration> queryCondition){
        return voucherBuryingPointConfigurationService.query(queryCondition);
    }
    @PostMapping("/listBuryingPoint")
    @ApiOperation(value = "查询埋点事件")
    @SysLog(value = "查询埋点事件")
    public IResponse listBuryingPoint(@RequestBody VoucherBuryingPointConfiguration queryCondition){
        return voucherBuryingPointConfigurationService.listBuryingPoint(queryCondition);
    }
}


